package com.fairy.sso.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.fairy.sso.annotation.FairyControllerExceptionLog;
import com.fairy.sso.config.FairyConfig;
import com.fairy.web.common.FairyConstants;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

@Controller
public class FilterController {

	private static Logger log = Logger.getLogger(FilterController.class);
	@Autowired(required=true)
	private FairyConfig fairyConfig;
	@RequestMapping ("/filter.do")
	@FairyControllerExceptionLog(description="")
	public ModelAndView filter(HttpServletRequest request,Model model)
	{
	    ModelAndView mav = new ModelAndView(FairyConstants.JSON_VIEW_RETAIN_DEFINED_VIEW); 
 
	    ObjectMapper mapper = new ObjectMapper();  
	    String json="";
		try {
			json = "-----------";mapper.writeValueAsString("");
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}

		log.info("返回数据::::"+json);
		//将自己组装的json数据返给自定义JsonView  
		mav.addObject(FairyConstants.JSON_VIEW_RETAIN_DATA,json);
	    return mav; 
	}
}
